﻿
/**
 * Created by Administrator on 2017/6/20.
 */
angular.module('services', [])
    // .directive('fGuide', [function() {
    //     return function(scope, element, attr){
    //         scope.loadGuide();
    //     }
    // }])
    .run(['$anchorScroll',function($anchorScroll){
        $anchorScroll.yOffset = 200;
    }])
    .filter('price_filter',function(){
        return function(text){
            text = parseFloat(text);
            return text.toFixed(2);
        }
    })
    .directive("ngTouchmove", function () {
        return {
            controller: ["$scope", "$element", function ($scope, $element) {

                $element.bind("touchmove", onTouchMove);
                function onTouchMove(event) {
                    event.stopPropagation();
                    event.preventDefault();
                    var method = $element.attr("ng-touchmove");
                    $scope.$apply(method);
                }

            }]
        }
    })
    .directive('zFooter', [function() {
        return {
            restrict: 'E',
            templateUrl: 'tpl/footer.html'
            //link: function(scope, elem, attr) {
            //    $(elem).on('click', '.footer_nav', function() {
            //        $(this).addClass('footer_active').siblings().removeClass('footer_active');
            //    })
            //}
        }
    }])
    .directive('onFinish', function($timeout) {
        return function(scope, element, attr) {
            if (scope.$last === true) {
                $timeout(function() {
                    scope.$emit('ngRepeatFinished');
                });

            }
        }
    })
    //多选
    .directive('allCheck', function() {
        return function(scope, element, attr) {
            $(element).click(function() {
                var isCheck = $(this).attr('src') == "image/suc_weixuanzhe.png";
                if (isCheck) {
                    $('.gwc-select').attr('src', "image/suc.png");
                    $('.all-select').attr('src', "image/suc.png");
                    scope.allPrices();
                    scope.$apply();
                } else {
                    $('.gwc-select').attr('src', "image/suc_weixuanzhe.png");
                    $('.all-select').attr('src', "image/suc_weixuanzhe.png");
                    scope.allPrices();
                    scope.$apply();
                }
                // angular.forEach(scope.dataList, function(data, index, array) {
                //     data.Bol = isCheck;
                // })
                // scope.allPrices();
                // scope.$apply();
            })
        }
    })


    //单选
    .directive('oneCheck', function() {
        return function(scope, element, attr) {
            var suc = 0;
            $(element).click(function() {
                var isCheck = $(this).attr('src') == "image/suc_weixuanzhe.png";
                if (isCheck) {
                    $(this).attr('src', "image/suc.png");
                    for (var a = 0; a < $('.gwc-select').size(); a++) {
                        if ($('.gwc-select').eq(a).attr("src") == "image/suc.png") {
                            suc++;
                            if (suc == $('.gwc-select').size()) {
                                $('.all-select').attr('src', "image/suc.png");
                            }
                        }
                    }
                    scope.allPrices();
                    scope.$apply();
                } else {
                    $(this).attr('src', "image/suc_weixuanzhe.png");
                    $('.all-select').attr('src', "image/suc_weixuanzhe.png");
                    suc = 0;
                    scope.allPrices();
                    scope.$apply();
                }
                // var This = this
                // angular.forEach(scope.dataList, function(data, index, array) {
                //     if (attr.items == data.items) {
                //         var isCheck = $(This).prop('checked');
                //         data.Bol = isCheck;
                //         scope.allPrices();
                //         scope.$apply();
                //     }
                // })
            });
        }
    })
    .factory('$zhaopianSelect', [function() {
        return {
            zpslt: function(num, fn) {
                var UIMediaScanner = api.require('UIMediaScanner');
                UIMediaScanner.open({
                    type: 'picture',
                    column: 4,
                    classify: true,
                    max: 1,
                    sort: {
                        key: 'time',
                        order: 'desc'
                    },
                    texts: {
                        stateText: '已选择*项',
                        cancelText: '取消',
                        finishText: '完成'
                    },
                    styles: {
                        bg: '#fff',
                        mark: {
                            icon: '',
                            position: 'bottom_left',
                            size: 20
                        },
                        nav: {
                            bg: '#eee',
                            stateColor: '#000',
                            stateSize: 18,
                            cancelBg: 'rgba(0,0,0,0)',
                            cancelColor: '#000',
                            cancelSize: 18,
                            finishBg: 'rgba(0,0,0,0)',
                            finishColor: '#000',
                            finishSize: 18
                        }
                    },
                    exchange: true,
                    rotation: true
                }, function(ret) {
                    if (ret.list != undefined) {
                        // for(var i = 0;i<ret.list.length;i++){
                        //   console.log(JSON.stringify(ret.list[i].path));
                        // }
                        for (var i = 0; i < ret.list.length; i++) {
                            UIMediaScanner.transPath({
                                path: ret.list[i].path
                            }, function(ret, err) {
                                if (ret) {
                                    fn(ret.path);
                                }
                            });
                        }

                        // alert("file://" + ret.list[0].path);
                        // var trans = api.require('trans');
                        // trans.decodeImgToBase64({
                        //     imgPath: "file://" + ret.list[0].path
                        // }, function(ret, err) {
                        //     if (ret.status) {
                        //         $("#image").attr("str","data:image/jpg;base64,"+ret.base64Str);
                        //         alert( $("#image").attr("str"));
                        //     } else {
                        //         alert(JSON.stringify(err));
                        //     }
                        // });

                    }
                });
            }
        }
    }])
    .factory('$riqiSelect', [function() {
        return {
            riqi: function(dts, fn) {
                var UIActionSelector = api.require('UIActionSelector');
                UIActionSelector.open({
                    datas: dts,
                    layout: {
                        row: 5,
                        col: 3,
                        height: 30,
                        size: 12,
                        sizeActive: 14,
                        rowSpacing: 5,
                        colSpacing: 10,
                        maskBg: 'rgba(0,0,0,0.2)',
                        bg: '#ccc',
                        color: '#888',
                        colorActive: '#f00',
                        colorSelected: '#f00'
                    },
                    animation: true,
                    cancel: {
                        text: '取消',
                        size: 12,
                        w: 90,
                        h: 35,
                        bg: '#fff',
                        bgActive: '#ccc',
                        color: '#888',
                        colorActive: '#fff'
                    },
                    ok: {
                        text: '确认',
                        size: 12,
                        w: 90,
                        h: 35,
                        bg: '#fff',
                        bgActive: '#ccc',
                        color: '#888',
                        colorActive: '#fff'
                    },
                    title: {
                        text: '请选择',
                        size: 12,
                        h: 44,
                        bg: '#eee',
                        color: '#888'
                    },
                    fixedOn: api.frameName
                }, fn);
            }
        }
    }])
    // .factory('$tuichu', [function() {
    //     return {
    //         click: function() {
    //             var isfinisha = false;
    //             setTimeout(function() {
    //                 api.addEventListener({
    //                     name: 'keyback'
    //                 }, function(ret, err) {
    //                     if (isfinisha) {
    //                         api.closeWidget({
    //                             silent: true
    //                         });
    //                     } else {
    //                         console.log(location.pathname);
    //                         api.toast({
    //                             msg: '再按一次返回键退出',
    //                             duration: 2000,
    //                             location: 'bottom'
    //                         });
    //                         isfinisha = true;
    //                         bolsettime();
    //                     }
    //                 });
    //             }, 1500);
    //
    //             function bolsettime() {
    //                 setTimeout(function() {
    //                     isfinisha = false;
    //                 }, 1000);
    //             }
    //
    //         },
    //         remove: function() {
    //             api.removeEventListener({
    //                 name: 'keyback'
    //             });
    //         }
    //     }
    // }])
    .factory('$swipers', [function() {
        return {
            swp: function(elm, lop, atp, spv, spg, pagin, pbtn, nbtn, spb, fm, fn) {
                setTimeout(function() {
                    var mySwiper = new Swiper(elm, {
                        loop: lop,
                        autoplay: atp, //可选选项，自动滑动
                        autoplayDisableOnInteraction: false,
                        paginationClickable: true,
                        slidesPerView: spv,
                        slidesPerGroup: spg,
                        pagination: pagin,
                        prevButton: pbtn,
                        nextButton: nbtn,
                        spaceBetween: spb,
                        freeMode: fm, //自由滑动
                        onSlideChangeStart: fn
                    })
                }, 10);

            }
        }
    }])
    .factory('$swipers1', [function() {
        return {
            swp: function(elm) {
                setTimeout(function() {
                    var mySwiper = new Swiper(elm, {
                        slidesPerView: 2.3,
                        // loop: true,
                        autoplay: 0, //可选选项，自动滑动
                        autoplayDisableOnInteraction: false,
                        loopedSlides: 8,
                        slidesPerGroup: 2
                        // spaceBetween: 20,
                    })
                }, 10);

            }
        }
    }])
    .factory('$swplist', [function() {
        return {
            swplist: function(elm) {
                setTimeout(function() {
                    var swiper = new Swiper(elm, {
                        slidesPerView: 'auto',
                        freeMode: true,
                        freeModeMomentumBounce: false,
                        freeModeSticky: true,
                        freeModeMomentumVelocityRatio: 20,
                        resistanceRatio: 0,
                        spaceBetween: 10
                    });
                }, 10);

            }
        }
    }])
    .factory('$codeScanner', [function() {
        return {
            codescan: function(fn, fm) {
                var FNScanner = api.require('FNScanner');
                FNScanner.openScanner({
                    autorotation: true
                }, function(ret, err) {
                    if (ret.content != undefined) {
                        var retstr = ret.content + "";
                        if (retstr.toLowerCase().indexOf("https") >= 0 || retstr.toLowerCase().indexOf("http") >= 0) {
                            fn(retstr);
                        } else {
                            fm(retstr);
                        }
                    } else {
                        // alert(JSON.stringify(err));
                    }
                });
            }
        }
    }])
    .factory('$bMap', [function() {
        return {
            bMap: function(y, w, h) {
                var map = api.require('bMap');
                map.open({
                    rect: {
                        x: 0,
                        y: y,
                        w: w,
                        h: h
                    },
                    zoomLevel: 10,
                    showUserLocation: true,
                    fixedOn: api.frameName,
                    fixed: true
                }, function(ret) {
                    if (ret.status) {
                        alert('地图打开成功');
                    }
                });
                map.showUserLocation({
                    isShow: true,
                    trackingMode: 'none'
                });
            },
            setRect: function(y, w, h) {
                var map = api.require('bMap');
                map.setRect({
                    rect: {
                        x: 0,
                        y: y,
                        w: w,
                        h: h
                    }
                });
            },
            bMapclose: function() {
                var map = api.require('bMap');
                map.close();
            },
            bMapshow: function() {
                var map = api.require('bMap');
                map.show();
            },
            bMaphidden: function() {
                var map = api.require('bMap');
                map.hide();
            },
            bMapNP: function() {
                var map = api.require('bMap');
                map.showUserLocation({
                    isShow: true,
                    trackingMode: 'none'
                });
            },
            bMapDPP: function(bmid, bmlon, bmlat, fn) {
                var map = api.require('bMap');
                map.addAnnotations({
                    annotations: [{
                        id: bmid,
                        lon: bmlon,
                        lat: bmlat
                    }],
                    draggable: true
                }, function(ret) {
                    if (ret) {
                        fn(ret);
                        // map.getAnnotationCoords({
                        //     id: ret.id
                        // }, function(ret) {
                        //     if (ret) {
                        //
                        //     }
                        // });

                    }
                });
            },
            bMapRemoveP: function(bMaparr) {
                var map = api.require('bMap');
                map.removeAnnotations({
                    ids: bMaparr
                });
            },
            bMapsetcent: function(mlon, mlat) {
                var map = api.require('bMap');
                map.setCenter({
                    coords: {
                        lon: mlon,
                        lat: mlat
                    },
                    animation: true
                });
            },
            bMapLocalCity: function() {
                var bMap = api.require('bMap');
                var txt = "";
                return bMap.getLocation({
                    accuracy: '1km',
                    autoStop: true,
                    filter: 1
                }, function(ret, err) {
                    if (ret.status) {
                        //alert(JSON.stringify(ret));
                        return bMap.getNameFromCoords({
                            lon: ret.lon,
                            lat: ret.lat
                        }, function(ret, err) {
                            if (ret.status) {
                                //alert(JSON.stringify(ret));
                                txt = ret.city + " " + ret.district;
                                //alert(txt + "111");//正常
                                return txt;//undefined
                            }
                        });
                    } else {
                        alert(err.code);
                    }
                })/*.then(function(){
                 alert(txt + "333");//
                 return txt;//""
                 })*/;
                //alert(txt + "222");//
                //return txt;//""
            }
        }
    }])
    // .factory('$wufengswipers', [function() {
    //     return {
    //         wufengswp: function(elm) {
    //             var tran, time, wid, size;
    //             setTimeout(function() {
    //                 var swiper = new Swiper(elm, {
    //                     slidesPerView: 2.2,
    //                     slidesPerGroup: 2,
    //                     noSwiper: true,
    //                     onInit: function(swiper) {
    //                             // var oldhtml = $(".sc_banner_zt-warp").html();
    //                             // $(".sc_banner_zt-warp").html(oldhtml + oldhtml + oldhtml);
    //                             // swiper.update();
    //                             //888888888888888888888888888888888888888888888888888888888888
    //                         //     $(".sc_banner_zt-warp").css("cssText", "transition-duration: 0ms !important;");
    //                         //     wid = $(".sc_banner_zt-slide").width();
    //                         //     size = $(".sc_banner_zt-slide").size();
    //                         //     tran = 0;
    //                         //     time = setInterval(function() {
    //                         //         $(".sc_banner_zt-warp").css("transform", "translate3d(" + tran + "px,0px,0px)");
    //                         //         if (-tran >= wid * size / 2) {
    //                         //             tran = 0;
    //                         //         } else {
    //                         //             tran -= 0.5;
    //                         //         }
    //                         //     }, 1);
    //                         }
    //                         //888888888888888888888888888888888888888888888888888888888888
    //
    //                         // ,
    //                         // onTouchStart: function(swiper) {
    //                         //     clearInterval(time);
    //                         //     $(".sc_banner_zt-warp").css("cssText", "transition-duration: 0ms !important;");
    //                         //
    //                         // },
    //                         // onTouchEnd: function(swiper) {
    //                         //     tran = swiper.getWrapperTranslate();
    //                         //     setTimeout(function() {
    //                         //         time = setInterval(function() {
    //                         //             $(".sc_banner_zt-warp").css("cssText", "transition-duration: 0ms !important;");
    //                         //             $(".sc_banner_zt-warp").css("transform", "translate3d(" + tran + "px,0px,0px)");
    //                         //             if (-tran >= wid * size / 3 + wid * 3) {
    //                         //                 tran = -wid * size / 3;
    //                         //             } else if (-tran <= wid * size / 3 - wid) {
    //                         //                 tran = tran - wid * size / 3;
    //                         //             } else {
    //                         //                 tran -= 0.5;
    //                         //             }
    //                         //         }, 1);
    //                         //     }, 10);
    //                         // }
    //                 });
    //             }, 10);
    //         },
    //         stopswp: function() {
    //             for (var i = 1; i < 1000; i++) {
    //                 clearInterval(i);
    //             }
    //         }
    //     }
    // }])
    //上拉加载
    .factory('$loadMore', [function() {
        return {
            //滚动条在Y轴上的滚动距离
            getScrollTop: function() {
                var scrollTop = 0,
                    bodyScrollTop = 0,
                    documentScrollTop = 0;
                if (document.body) {
                    bodyScrollTop = document.body.scrollTop;
                }
                if (document.documentElement) {
                    documentScrollTop = document.documentElement.scrollTop;
                }
                scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop;
                return scrollTop;
            },
            //文档的总高度
            getScrollHeight: function() {
                var scrollHeight = 0,
                    bodyScrollHeight = 0,
                    documentScrollHeight = 0;
                if (document.body) {
                    bodyScrollHeight = document.body.scrollHeight;
                }
                if (document.documentElement) {
                    documentScrollHeight = document.documentElement.scrollHeight;
                }
                scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight;
                return scrollHeight;
            },
            //浏览器视口的高度
            getWindowHeight: function() {
                var windowHeight = 0;
                if (document.compatMode == "CSS1Compat") {
                    windowHeight = document.documentElement.clientHeight;
                } else {
                    windowHeight = document.body.clientHeight;
                }
                return windowHeight;
            }
        }
    }])
    //分享
    .factory('$share', function() {
        return {
            share: function(obj) {
                var sharedModule = api.require('shareAction');
                sharedModule.share(obj);
            }
        }
    })
    .factory('$chushihua', [function() {
        return {
            scrollTo: function() {
                $('html,body').animate({
                    scrollTop: 0
                });
            }
        }
    }])
    .factory('$openapp', [function() {
        return {
            open: function(lei,url,fn) {
                if (lei == "alipay") {
                    var systemType = api.systemType;
                    // alert(systemType);
                    if(systemType == "ios"){
                        api.openApp({
                            iosUrl: url
                        },fn);
                    }else{
                        api.openApp({
                            androidPkg: 'android.intent.action.VIEW',
                            mimeType: 'text/html',
                            uri: url
                        }, fn);
                        // api.openWin({
                        //     name: 'page1',
                        //     url: url
                        // },fn);
                    }
                } else {
                    api.openApp({
                        uri: url
                    });
                }
            },
            openpay: function(oid, fn) {
                var systemType = api.systemType;
                if(systemType == "ios"){
                    api.openApp({
                        iosUrl: baison.site + "theme/web5/index.html#/zhiFuZhongJianYe/yinlian/" + oid
                    }, fn);
                }else{
                    api.openApp({
                        androidPkg: 'android.intent.action.VIEW',
                        mimeType: 'text/html',
                        uri: baison.site + "theme/web5/index.html#/zhiFuZhongJianYe/yinlian/" + oid
                    }, fn);
                }
            }
        }
    }])
    .factory('$talk', [function() {
        return {
            tanChuang: function(content, obj) {
                var html = '<div class="gwc_zzc_queren"><div class="gwc_zzc_box"><div class="gwc_zzc_sc">' + content + '</div></div></div>';
                $(obj).html(html);
            }
        }
    }])
    .factory('$toast', [function() {
        return {
            tan: function(msg) {
                api.toast({
                    msg: msg,
                    duration: 2000,
                    location: 'bottom'
                });
            }
        }
    }])
    //等ng-repeat渲染完成后的操作
    .directive('repeatFinish', function() {
        return {
            link: function(scope, element, attr) {
                if (scope.$last == true) {
                    scope.$eval(attr.repeatFinish)
                }
            }
        }
    })


    //小能客服
    .factory('$ntkf', function() {
        return {
            init: function() {

            }
        }
    })
    .factory('$dianzan', ['$http',function($http) {
        return {
            dianzan: function(comment_id,detail_id,k,index) {
                var mudidiv = $(this).parents(".syly-win-main-liuyan-caozuo-zan").find(".zanhfs");
                var params = {};
                params.method = "article.set.comment.zan";
                var p_params = {
                    comment_id:comment_id,
                    detail_id:detail_id
                };

                params.params = JSON.stringify(p_params);
                $http.get(baison.get_url('api/', params))
                    .success(function (data) {
                        if (data.status == 1) {
                            data = data.data;
                            mudidiv.html(Number(mudidiv.html())+1);
                            if(index == -1){
                                comment[k].zan = Number(comment[k].zan)+1
                                //$($event.target).attr("src","image/redzan.jpg");
                                comment[k].is_zan = 1;
                            }else{
                                comment[k].detail[index].zan = Number(comment[k].detail[index].zan)+1
                                //$($event.target).attr("src","image/redzan.jpg");
                                comment[k].detail[index].is_zan = 1;
                            }
                        }
                    });
            }
        }
    }])

    .factory('$baidulocation', [function() {
        return {
            location: function (callback_function) {
                var geolocation = new BMap.Geolocation();

                var all = shi = qu = jiedao = '';

                geolocation.getCurrentPosition(
                    //获取位置信息成功
                    function (position) {
                        if (this.getStatus() == BMAP_STATUS_SUCCESS) {
                            longitude = position.point.lng;
                            latitude = position.point.lat;
                            // 根据坐标得到地址描述
                            var myGeo = new BMap.Geocoder();
                            // 根据坐标得到地址描述
                            myGeo.getLocation(new BMap.Point(longitude, latitude),
                                function (result) {
                                    if (result) {
                                        geoaddress = {
                                            'fulladdress': result.addressComponents.city + result.addressComponents.district + result.addressComponents.street,
                                            'city': result.addressComponents.city,
                                            'area': result.addressComponents.district,
                                            'street': result.addressComponents.street,
                                        };
                                        all = result.addressComponents.city + result.addressComponents.district;
                                        shi = result.addressComponents.city;
                                        qu = result.addressComponents.district;
                                        jiedao = result.addressComponents.street;

                                        callback_function({'all':all,'shi':shi,'qu':qu,'jiedao':jiedao,'lon':longitude,'lat':latitude});

                                        //alert(JSON.stringify($scope.all))
                                    } else {
                                        alert("定位失败,地址解析失败");
                                    }
                                });
                        }
                    }, {
                        // 指示浏览器获取高精度的位置，默认为false
                        enableHighAccuracy: true,
                        // 指定获取地理位置的超时时间，默认不限时，单位为毫秒
                        // timeout: 5000,
                        // 最长有效期(30S)，在重复获取地理位置时，此参数指定多久再次获取位置
                        maximumAge: 30 * 1000
                    });
            },
        }

    }])

    .factory('$httpRequest', ['$http',function($http) {
        return {
            getResult: function (method,p_params,callback_function) {
                var params = {};
                params.method = method;
                params.params = JSON.stringify(p_params);
                $http.get(baison.get_url('api/', params))
                    .success(function (data) {
                        callback_function(data);
                    });
            },
            getResultNoParams: function (method,params,callback_function) {
                params.method = method;
                $http.get(baison.get_url('api/', params))
                    .success(function (data) {
                        callback_function(data);
                    });
            },
            postResult: function (method,p_params,callback_function) {
                var params = {};
                params.method = method;
                params.params = JSON.stringify(p_params);
                $http.post(baison.get_url('api/', params))
                    .success(function (data) {
                        callback_function(data);
                    });
            },
            getRequestParams:function(method,p_params){
                var params = {};
                params.method = method;
                params.params = JSON.stringify(p_params);
                return params;
            }
        }

    }])

    .factory('$imgupload',['$httpRequest','$http', function($httpRequest,$http){
        return {
            chageimg:function(ret,imgUploadParams,imgUploadCallbackFunction){
                if(ret != undefined){
                    $(".gwc_zzc_queren").toggleClass("disnone");
                    // var img = "file://" + ret; //imgurl 就是你的图片路径
                    $("#image").attr("src", ret);
                    function getBase64Image(img) {
                        var canvas = document.createElement("canvas");
                        canvas.width = img.width;
                        canvas.height = img.height;
                        // var quality = 0.7;
                        var ctx = canvas.getContext("2d");
                        ctx.drawImage(img, 0, 0, img.width, img.height);
                        var ext = img.src.substring(img.src.lastIndexOf(".") + 1).toLowerCase();
                        var dataURL = canvas.toDataURL("image/" + ext);
                        return dataURL;
                    }
                    var image = new Image();
                    image.src = ret;
                    var imgtxt = [];
                    var n = 300;
                    image.onload = function() {
                        var r = getBase64Image(image);
                        for(var i =0,l = r.length;i<l/n;i++){
                            var a = r.slice(n*i,n*(i+1));
                            imgtxt[i]=a;
                        }

                        $http({
                            method:'POST',
                            url:baison.get_url('api/', imgUploadParams),
                            data:{'imgtxt':imgtxt},
                            timeout:10000
                        }).success(function(data){
                            imgUploadCallbackFunction(data);
                        }).error(function(data){
                            $(".gwc_zzc_queren").toggleClass("disnone");
                            alert('请上传少于2M大小的图片');
                            //console.info(data);
                        });

                    }
                }
            }
        }
    }])

    .factory('$orderStatusDisplay',[function(){
        return {
            display: function (orderlist,callbackfunction) {

                var yfkdfhbol = yifahuobol = yidaohuobol = wanchengbol = yiquxiaobol = [];

                for (var i = 0; i < orderlist.length; i++) {
                    // 处理中 == 待发货
                    var record_code = "";
                    if (orderlist[i].status == 1 && orderlist[i].is_pay == 0) {
                        orderlist[i].yfkdfhbol = false;
                        orderlist[i].yifahuobol = false;
                        orderlist[i].yidaohuobol = false;
                        orderlist[i].wanchengbol = false;
                        orderlist[i].yiquxiaobol = false;
                        orderlist[i].weifukuanbol = true;

                    } else if (orderlist[i].status == 1 && orderlist[i].is_pay == 1){
                        orderlist[i].yfkdfhbol=true;
                        orderlist[i].yifahuobol=false;
                        orderlist[i].yidaohuobol=false;
                        orderlist[i].wanchengbol=false;
                        orderlist[i].yiquxiaobol=false;
                        orderlist[i].weifukuanbol=false;
                    } else if (orderlist[i].status == 7) {
                        orderlist[i].weifukuanbol = false;
                        orderlist[i].yfkdfhbol = false;
                        orderlist[i].yifahuobol = false;
                        orderlist[i].yidaohuobol = false;
                        orderlist[i].wanchengbol = false;
                        orderlist[i].yiquxiaobol = true;
                    } else if (orderlist[i].status == 3) {
                        orderlist[i].weifukuanbol = false;
                        orderlist[i].yfkdfhbol = false;
                        if(orderlist[i].delivery_status==0){
                            orderlist[i].yifahuobol = false;
                        }else{
                            orderlist[i].yifahuobol = true;
                        }
                        orderlist[i].yidaohuobol = false;
                        orderlist[i].wanchengbol = false;
                        orderlist[i].yiquxiaobol = false;
                    } else if (orderlist[i].status == 5) {
                        orderlist[i].weifukuanbol = false;
                        orderlist[i].yfkdfhbol = false;
                        orderlist[i].yifahuobol = false;
                        orderlist[i].yidaohuobol = false;
                        if(orderlist[i].comment_status==0){
                            orderlist[i].wanchengbol = false;
                        }else{
                            orderlist[i].wanchengbol = true;
                        }
                        orderlist[i].yiquxiaobol = false;
                    }
                }
                callbackfunction(orderlist);
            }
        }
    }]);
